import smtplib

# 假设你的发件人邮箱和SMTP服务器设置
sender_email = "your-email@example.com"
receiver_email = "recipient-email@example.com"

# 如果SMTP服务器需要身份验证，可能还需要用户名和密码
smtp_server = "smtp.example.com"
username = "your-username"
password = "your-password"

# 构建邮件内容
message = """
Subject: Test Email
Hello, this is an automated email sent using Python's smtplib.
"""

# 创建SMTP会话并登录
with smtplib.SMTP(smtp_server, 587) as server:
    server.starttls()
    server.login(username, password)
    
    # 添加From: 头部信息
    msg = f"From: {sender_email}\n\n{message}"
    
    # 发送邮件
    server.sendmail(sender_email, receiver_email, msg)

# 关闭连接
server.quit()